package com.shop.controller;

import com.shop.pojo.User;
import com.shop.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class RegesiterController {
    @Autowired
    private UserService userService;
    //跳转到注册页面
    @RequestMapping(value = "/toregesiter")
    public String toregesiter(){
        return "regesiter";
    }
    @RequestMapping(value = "/registerUser")
    public String registerUser(User user){
        user.setUserisadmin(0);
        this.userService.insertUser(user);
        return "redirect:/login";
    }
}
